#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cassert>
#include <ctime>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
using namespace std;
int main()
{
    pid_t id = fork();
    if (id == 0)
    {
        cout << "我是子进程：" << getpid() << getppid() << id << endl;
        exit(2);
    }
    int status = 0;
    int n = waitpid(id, &status, 0);
    cout << "pid->" << n << " : " << (status & 0x7F) << endl;
    cout << "我是父进程：" << getpid() << "  " << getppid() << "    " << id << endl;
    return 0;
}